package cn.edu.zwu;


import cn.edu.zwu.dao.User;
import cn.edu.zwu.service.UserService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
//import org.springframework.context.support.FileSystemXmlApplicationContext;

public class Main {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("application.xml");
//        ApplicationContext context = new FileSystemXmlApplicationContext("src/main/resources/application.xml");

        UserService userService = context.getBean(UserService.class);
        User user1 = userService.login("Bob", "password");
        User user2 = userService.login("Alice", "password");
        User user3 = userService.login("Tom", "password");
        User user4 = userService.register(4, "Charlie", "password", "charlie@example.com", "12345");
        System.out.println("User Login:" + user1.getUserName());
        System.out.println("User Login:" + user2.getUserName());
        System.out.println("User Login:" + user3.getUserName());
        System.out.println("User Login:" + user4.getUserName());


    }
}